﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HNQXYJ.Model;
using HNQXYJ.BLL;

namespace HNQXYJ.DataCenterJS
{
    public partial class UsersAdd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void add_Click(object sender, ImageClickEventArgs e)
        {
           
            int res = 0;
            Users user = new Users();
            user.UserName = this.txtUserName.Text.Trim();
            user.Password =UsersBLL.GetMD5(this.txtPwd.Text.Trim());
            user.TrueName = this.txtTrueName.Text.Trim();
            user.RankName = "000";
            user.RankLevel = "000";
            user.TouchMethod = txtTouchMehtod.Text.Trim();
            user.AddDate = DateTime.Now;
            user.ErrTimes = 0;
            user.Notes = this.txtNotes.Text.Trim();
            res = new UsersBLL().AddNew(user);
            if (res > 0)
            {
                Response.Redirect("UsersGetDataAll.aspx", true);
            }
            else
            {
                this.Label1.Text = "添加失败 用户名已存在！";
            }

           
        }

        protected void reset_Click(object sender, ImageClickEventArgs e)
        {
            this.txtUserName.Text = "";
            this.txtPwd.Text = "";
            this.txtTrueName.Text = "";
            this.txtTouchMehtod.Text = "";
            this.txtNotes.Text = "";
        }
    }
}